﻿<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>主菜单</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<script src="${ctx}/scripts/sys/ccorrect_btn.js"></script>
<style>
a{ display:block; height:22px; line-height:22px;font-size:12px;}
.L22 a:hover{left:1px;top:1px;position:relative;}
#menu{ width:177px; margin:0 auto; text-align:left; border:1px solid #89D1E7;}
.L22{ min-height:22px; margin-left:15px;}
.L1{ cursor:pointer; display:block;}
.U1{ margin-top:8px; margin-bottom:4px; }
.active{background:url(${ctx}/images/main/l_open.gif) no-repeat; padding-left:15px;}
.act{background:url(${ctx}/images/main/l_add.gif) no-repeat; padding-left:15px;}
</style>
</head>
<body >
<input  type="hidden" name="request_locale" value="${session['WW_TRANS_I18N_LOCALE']}"/>

<s:if test="'en_US'== #session['WW_TRANS_I18N_LOCALE'].toString() ">
<div id="menu">
<ul>
	<s:iterator value="sysMenus" status="sysMenu" id="m">
	<li class="L1"><a href="javascript:c('m<s:property value='#sysMenu.index+1'/>');" id="m<s:property value='#sysMenu.index+1'/>" class="act"><h1 class="limg"><img src="${ctx}/images/menu/<s:property value='#m.menuImage'/>.gif" /></h1><s:property value="#m.menuNameEn"/></a></li>
		<ul id="m<s:property value='#sysMenu.index+1'/>d" style="display:none;" class="U1">
			<s:iterator value="#m.sysFuncs" status="sysFunc" id="f1">
				<li class="L22"><a  <s:if test="'/@'==#f1.funcCode "> href="#"  onclick="c('f<s:property value='#sysMenu.index+1'/><s:property value='#sysFunc.index+1'/>');"  </s:if><s:else>href="${ctx}<s:property value="#f1.funcCode"/>.action"  target="framemain"</s:else>    id="f<s:property value='#sysMenu.index+1'/><s:property value='#sysFunc.index+1'/>"><h1 class="limg"><img src="images/main/aimg2.gif" /></h1><s:property value="#f1.funcNameEn"/></a></li>
					<ul id="f<s:property value='#sysMenu.index+1'/><s:property value='#sysFunc.index+1'/>d" style="display:none; margin-left:15px;">
					<s:iterator value="#f1.sysFuncs" status="sysFunc1" id="f2">
					<li class="L3"><a href="${ctx}<s:property value="#f2.funcCode"/>.action" target="framemain"><h1 class="limg"><img src="images/main/aimg3.gif" /></h1><s:property value="#f2.funcNameEn"/></a></li>
				</s:iterator>
			</ul>
				</s:iterator>
		</ul>
	</s:iterator>
</ul>
</div>
</s:if>


<s:else>
<div id="menu">
<ul>
<s:iterator value="sysMenus" status="sysMenu" id="m">
<li class="L1"><a href="javascript:c('m<s:property value='#sysMenu.index+1'/>');" id="m<s:property value='#sysMenu.index+1'/>" class="act"><h1 class="limg"><img src="${ctx}/images/menu/<s:property value='#m.menuImage'/>.gif" /></h1><s:property value="#m.menuName"/></a></li>
<ul id="m<s:property value='#sysMenu.index+1'/>d" style="display:none;" class="U1">
<s:iterator value="#m.sysFuncs" status="sysFunc" id="f1">
<li class="L22"><a <s:if test="'/@'==#f1.funcCode "> href="#"  onclick="c('f<s:property value='#sysMenu.index+1'/><s:property value='#sysFunc.index+1'/>');"  </s:if><s:else>href="${ctx}<s:property value="#f1.funcCode"/>.action"  target="framemain"</s:else>    id="f<s:property value='#sysMenu.index+1'/><s:property value='#sysFunc.index+1'/>"><h1 class="limg"><img src="images/main/aimg2.gif" /></h1><s:property value="#f1.funcName"/></a></li>
	<ul id="f<s:property value='#sysMenu.index+1'/><s:property value='#sysFunc.index+1'/>d" style="display:none; margin-left:15px;">
	<s:iterator value="#f1.sysFuncs" status="sysFunc1" id="f2">
	<li class="L3"><a href="${ctx}<s:property value="#f2.funcCode"/>.action" target="framemain"><h1 class="limg"><img src="images/main/aimg3.gif" /></h1><s:property value="#f2.funcName"/></a></li>
	
	</s:iterator>
	</ul>
</s:iterator>
</ul>
</s:iterator>
</ul>
</div>
</s:else>
<script src="${ctx}/scripts/sys/utility.js"></script>
<script language="JavaScript">
var sub_menu="1";
function view_menu(id)
{
   set_current("");
   if($("menu").innerHTML.toLowerCase().indexOf("<li") >= 0)
      $("menu_code_"+sub_menu).innerText=$("menu").innerHTML;
   
   if($("menu_code_"+id).innerText=="" || isUndefined($("menu_code_"+id).innerText))
   {
      $("menu").innerHTML="<img src='${ctx}/images/loading.gif' align='absMiddle'> 加载中，请稍候……";
      if(id==2) args="MENU_TYPE=SHORTCUT";
      else if(id==3) args="MENU_TYPE=OA";
      else if(id==4) args="MENU_TYPE=EA";
      else if(id==5) args="MENU_TYPE=FIS";
      else args="";
      _get("menu_code.php", args, update_menu, true);
   }
   else
   {
      $("menu").innerHTML=$("menu_code_"+id).innerText;
   }
   $('link_'+sub_menu).className="";
   $('link_'+id).className="active";
   sub_menu=id;
   setCookie("MENU_UI", id);
}
function update_menu(req)
{
   if(req.status == 200)
   {
      if(req.responseText=="")
         $("menu").innerHTML="<div style='padding:10px;'>无可访问菜单</div>";
      else 
         $("menu").innerHTML=req.responseText;
   }
   else
   {
      $("menu").innerHTML="<div style='padding:10px;'>错误："+req.status+"</div>";
   }
}

var cur_id="",cur_expand="";
var flag=0,sflag=0;

//-------- 菜单点击事件 -------
function c(id)
{
  var targetid,targetelement;
  var strbuf;

  var el=$(id);
  if(!el)
     return;
  //-------- 如果点击了展开或收缩按钮---------
  targetid=el.id+"d";
  targetelement=document.getElementById(targetid);
  var expandUL=document.getElementById(cur_expand+"d");
  var expandLink=document.getElementById(cur_expand);

  if (targetelement.style.display=="none")
  {
     if(expandUL && expandLink && el.id.substr(0,1)=="m")
     {
        expandLink.className="act";
        expandUL.style.display='none';
     }
     if(el.id.substr(0,1)=="m")
        cur_expand=el.id;
     el.className="active";
     targetelement.style.display='';

  }
  else
  {
     el.className="act";
     targetelement.style.display="none";

     menu_flag=1;
     var links=document.getElementsByTagName("A");
     for (i=0; i<links.length; i++)
     {
       el=links[i];
       if(el.parentNode.className.toUpperCase()=="L1" && el.className=="active" && el.id.substr(0,1)=="m")
       {
          menu_flag=0;
          break;
       }
     }
  }
}
//-------- 打开网址 -------
function a(URL,id,open_window)
{
   set_current(id);
   if(URL.substr(0,7)!="http://" && URL.substr(0,6)!="ftp://")
      URL = "/general/"+URL;
   openURL(URL, open_window);
}
function b(URL,id,open_window)
{
   set_current(id);
   URL = "/app/"+URL;
   openURL(URL, open_window);
}
</script>

</body>
</html>
